package org.smartloli.kafka.eagle.infra.constant;

import org.springframework.stereotype.Component;

/**
 * Kafka parameter setting.
 */
@Component
public final class KafkaConstants {

    //kafka eagle global config args
    public static final String KAFKA_EAGLE_TOPIC_TOKEN = "kafka.eagle.topic.token";
    public static final String KAFKA_EAGLE_METRICS_CHARTS = "kafka.eagle.metrics.charts";
    public static final String KAFKA_EAGLE_METRICS_RETAIN = "kafka.eagle.metrics.retain";
    public static final String METRIC_GROUP_NAME = "topic-management-service";
    public static final String CONSUMER_OFFSET_TOPIC = "__consumer_offsets";
    public static final String KAFKA_EAGLE_SYSTEM_GROUP = "kafka.eagle.system.group";
    public static final String EARLIEST = "earliest";

    /**
     * Single Batch Max Fetch Message Num
     **/
    public static final int POLL_MESSAGE_TIME_OUT_MS = 200;
    public static final String UNKNOWN = "Unknown";
    public static final String JOB_PARAMS = "job_params";

    //KafkaConstants
    public static String[] TYPE = new String[]{"DingDing", "KafkaConstants", "Email"};
    public static String[] CLUSTER = new String[]{"Kafka", "KafkaConstants", "Topic", "Producer"};
    public static String[] LEVEL = new String[]{"P0", "P1", "P2", "P3"};
    public static final String BUILT_IN_CONSUMER_GROUP_ID = "kafka.eagle";
    public static String EMAIL = "Email";
    public static String DingDing = "DingDing";
    public static String KafkaConstants = "KafkaConstants";
    public static String DISABLE = "N";
    public static String TOPIC = "Topic";
    public static String PRODUCER = "Producer";

    public static final String KAFKA = "kafka";
    public static final int SIZE = 40;
    public static final int CHILD_SIZE = 20;
    public static final int ADMINISTRATOR = 1;
    public static final String TITLE = "Kafka Eagle Alert";
    public static final String LOGIN_USER_NAME = "LOGIN_USER_NAME";
    public static final String SYSTEM_VERSION = "version";
    public static final String UNKNOW_USER = "__unknow__";

    public static final String ERROR_LOGIN = "error_msg";
    public static final String ERROR_DISPLAY = "error_display";

    public static final String ADMIN = "admin";
    public static final String IF_SYSTEM_ADMIN = "IF_SYSTEM_ADMIN";
    public static final String SYSTEM = "System";
    /**
     * kafka zookeeper relative path
     **/
    public static final String BROKER_IDS_PATH = "/brokers/ids";

    public static final String CLUSTER_ALIAS = "clusterAlias";
    public static final String CLUSTER_ALIAS_LIST = "clusterAliasList";
    public static final int CLUSTER_ALIAS_LIST_LIMIT = 5;
    public static final String ZK_RECEIVED_PACKETS = "zk_packets_received";
    public static final String BROKER_TOPICS_PATH = "/brokers/topics";
    public static final String DELETE_TOPICS_PATH = "/admin/delete_topics";
    public static final String CONSUMERS_PATH = "/consumers";
    public static final String OWNERS = "/owners";
    public static final String TOPIC_ISR = "/brokers/topics/%s/partitions/%s/state";

    //Wechat
    public static final String TOUSER = "@all";
    public static final String TOPARTY = "PartyID1|PartyID2";
    public static final String TOTAG = "TagID1 | TagID2";
    public static final long AGENTID = 1;

    //KafkaConstants
    public static final String ZK_SEND_PACKETS = "zk_packets_sent";
    public static final String ZK_NUM_ALIVE_CONNECTIONS = "zk_num_alive_connections";
    /**
     * If kafka hasn't enable jmx function, default invalid jmx port: -1
     **/
    public static final Integer INVALID_JMX_PORT = -1;
    public static final String ZK_OUTSTANDING_REQUESTS = "zk_outstanding_requests";
    public static final String LEADER = "leader";
    /**
     * kafka jmx path pattern
     **/
    public static final String JMX_URL_FORMAT = "service:jmx:rmi:///jndi/rmi://%s/jmxrmi";
    public static int[] MAX_TIMES = new int[]{-1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
}